package com.wwl.open.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wwl.open.entity.Monitor;
import com.wwl.open.mapper.MonitorMapper;
import com.wwl.open.service.MonitorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> implements MonitorService {
    @Autowired
    private MonitorMapper monitorMapper;

    @Override
    public List<Monitor> getAllMonitors() {
        return this.list();
    }

    @Override
    public Monitor createMonitor(Monitor monitor) {
        this.save(monitor);
        return monitor;
    }

    @Override
    public List<Monitor> getHistoricalData(LocalDateTime startDate) {
        return monitorMapper.selectHistoricalData(startDate);
    }
}